Coldfusion has a great function called "gettickcount()" which basically gives you the current time in milliseconds. This is a great function to time code. Look at the example below:

<cfset stime = getTickCount()>

<!--- All my code to time here --->

<cfloop from="1" to="100" index="i">

<cfoutput>testing #i#</cfoutput>

<!--- Make a call here --->

</cfloop>

<cfset totalTime = getTickCount() - stime>

<cfoutput>The total time of execution for the code was: #totalTime#</cfoutput>

This utility is great. The question is, how do I do this in Java?? Well very simple, we use the System class. The following is a simple snippet of how to time in java.

double stime = System.currentTimeMillis();

//My Code Here


for(int i=0;i< 1000; i++){

System.out.println(i);

}

double TotalTime = System.currentTimeMillis() - stime;

//Display Total Time


System.out.println("Total Time of Execution: " + TotalTime + "ms.");

There you go!! Now you can time your java code.